Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dependency_file_feature on macos features #22717

Conversation

PikachuHyA
Copy link
Contributor

This patch add dependency_file_feature to features when OS is macos.

the feature dependency_file_feature added by default through CppActionConfigs.java getLegacyFeatures

if (!existingFeatureNames.contains(CppRuleClasses.DEPENDENCY_FILE)) {
featureBuilder.add(
getFeature(
Joiner.on("\n")
.join(
" name: 'dependency_file'",
" enabled: true",
" flag_set {",
" action: 'assemble'",
" action: 'preprocess-assemble'",
" action: 'c-compile'",
" action: 'c++-compile'",
" action: 'c++-module-compile'",
" action: 'objc-compile'",
" action: 'objc++-compile'",
" action: 'c++-header-parsing'",
" action: 'clif-match'",
" flag_group {",
" expand_if_all_available: 'dependency_file'",
" flag: '-MD'",
" flag: '-MF'",
" flag: '%{dependency_file}'",
" }",
" }")));
}

Background

I modified tools/cpp/unix_cc_toolchain_config.bzl and found dependency_file not work on MacOS when testing #19940 with new action name c++20-deps-scanning and c++20-module-compile. After adding dependency_file_feature to features, it works.

cc @comius

@github-actions github-actions bot added team-Rules-CPP Issues for C++ rules awaiting-review PR is awaiting review from an assigned reviewer labels Jun 12, 2024
@comius comius added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Jun 14, 2024
copybara-service bot pushed a commit that referenced this pull request Jun 14, 2024
This patch adds `compiler_input_flags_feature` and `compiler_output_flags_feature` to the features.

follow #22717

By default, the features `compiler_input_flags_feature` and `compiler_output_flags_feature` are included through `CppActionConfigs.java` in the `getFeaturesToAppearLastInFeaturesList` method.

For reference, see the relevant code here:

https://github.com/bazelbuild/bazel/blob/0dbfaccaf5bee5ea7f11c01db1fc0cd1ca7f3810/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java#L1513-L1573

## Background

I modified `tools/cpp/unix_cc_toolchain_config.bzl` and found no input and output on macOS when testing #19940 with the new action names `c++20-deps-scanning` and `c++20-module-compile`.

As discussed in #22429 (comment), I added these two features to `unix_cc_toolchain_config.bzl`.

the Windows toolchains already have these features, so no modifications were necessary for `windows_cc_toolchain_config.bzl`.

- Windows input flags:

https://github.com/bazelbuild/bazel/blob/786a893ef6f69a8f77ca008a478bf67abfdcdc57/tools/cpp/windows_cc_toolchain_config.bzl#L1073-L1095

- Windows output flags:

https://github.com/bazelbuild/bazel/blob/786a893ef6f69a8f77ca008a478bf67abfdcdc57/tools/cpp/windows_cc_toolchain_config.bzl#L960-L1020

cc @comius

Closes #22743.

PiperOrigin-RevId: 643345702
Change-Id: I5715d25e12c7a3616d1fdb484f77ef7cd0fd1bba
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants